# import os
# from flask import Flask, send_from_directory
# import requests
#
# app = Flask(__name__)
#
# # 目标网页的URL
# TARGET_URL = 'https://www.baidu.com'
#
# # 发送请求获取favicon.ico
# response = requests.get(TARGET_URL + '/favicon.ico', stream=True)
# if response.status_code == 200:
#     # 保存favicon.ico到本地
#     with open('favicon.ico', 'wb') as f:
#         f.write(response.content)
#
# # 设置路由返回favicon.ico
# @app.route('/favicon.ico')
# def favicon():
#     return send_from_directory(os.path.join(app.root_path, 'static'),
#                                'favicon.ico', mimetype='image/vnd.microsoft.icon')
#
# if __name__ == '__main__':
#     app.run()


import config
from flask import Flask, render_template
from blueprints.search import search_blueprint
from blueprints.navigation import navigation_blueprint
from exts import db, mail


app = Flask(__name__)

app.config.from_object(config)
db.init_app(app)
mail.init_app(app)


app.register_blueprint(navigation_blueprint, url_prefix='/')
app.register_blueprint(search_blueprint, url_prefix='/search')


@app.route('/')
def index():
    return render_template('index.html')


if __name__ == '__main__':
    app.run(host='0.0.0.0', port=2024, debug=True)

